package com.dg11185.nearshop.net.request;

import com.dg11185.libs.network.http.client.HttpRequest;
import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.NetUtils;
import com.dg11185.nearshop.net.response.RegByMobilePhoneResponse;

public class RegByMobilePhoneRequest extends HttpRequest<RegByMobilePhoneResponse> {

    public final static String userName="userName";
    public RegByMobilePhoneRequest(String mobilePhone,
            String userPwd, String msgCode) {
        super(Constants.ADDRESS, Constants.regByMobilePhone);
        addParam("mobilePhone", mobilePhone);
        addParam("userPwd", userPwd);
        addParam("msgCode", msgCode);
        addParam("chshToken", Constants.TOKEN);
    }

    public RegByMobilePhoneRequest add(String key, String value) {
        addParam(key, value);
        return this;
    }

    public RegByMobilePhoneRequest encryption() {
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }
    @Override
    protected RegByMobilePhoneResponse parseJson(String response)
            throws Exception {
        RegByMobilePhoneResponse res = new RegByMobilePhoneResponse();
        res.parseJson(response);
        return res;
    }

}
